package net.cmkj.mine.common.listener;

import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;

import net.cmkj.mine.common.session.SessionContext;

public class SessionListener implements HttpSessionListener{

	private static Logger logger = LogManager.getLogger(SessionListener.class);
	
	public void sessionCreated(HttpSessionEvent event) {
		SessionContext.addSession(event.getSession());
		logger.info("session创建");
	}

	public void sessionDestroyed(HttpSessionEvent event) {
		// TODO Auto-generated method stub
		//User user = IWebUtils.getCurrentUser(arg0.getSession());
		HttpSession session = event.getSession();
		SessionContext.delSession(session);
		/*Object user = IWebUtils.getCurUser(session);
		if(user != null){
		}*/
		logger.info("session失效");
	}

}
